 package org.fcy.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class OpenApiConfig {

    @Bean
    public OpenAPI customOpenAPI() {
        String description = ""
                + "<h3>系统概述</h3>"
                + "<p>基于“药食同源”中医理念的智能食材推荐系统，结合现代营养学知识和大模型AI技术。</p>"
                + "<h3>核心功能</h3>"
                + "<ul>"
                + "  <li><b>用户管理</b>：用户注册、登录、信息管理</li>"
                + "  <li><b>食材库</b>：食材信息查询、分类浏览、详情展示</li>"
                + "  <li><b>智能问答</b>：药食同源专业问答助手</li>"
                + "  <li><b>个性化推荐</b>：基于用户健康信息的智能推荐</li>"
                + "  <li><b>收藏管理</b>：用户食材收藏功能</li>"
                + "</ul>"
                + "<h3>技术栈</h3>"
                + "<ul>"
                + "  <li>后端：Spring Boot + MyBatis Plus</li>"
                + "  <li>前端：Vue3 + Element Plus</li>"
                + "  <li>数据库：MySQL</li>"
                + "  <li>AI集成：LangChain4J + 大模型API</li>"
                + "</ul>";

        return new OpenAPI()
                .info(new Info()
                        .title("AI药食同源智能搭配系统 - API文档")
                        .description(description)
                        .version("1.0.0")
                        .contact(new Contact()
                                .name("AI药食同源开发团队")
                                .url("http://ai-food-medicine.com")
                                .email("support@ai-food-medicine.com"))
                        .termsOfService("http://ai-food-medicine.com/terms")
                        .license(new License()
                                .name("Apache License 2.0")
                                .url("http://www.apache.org/licenses/LICENSE-2.0")));
    }
}